<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>幕后任务协作调度</title>
  <style>
    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    }
    progress {
      width: 100%;
      margin: 10px 0;
    }
    .container {
      margin: 10px 0;
      padding: 10px;
      border: 1px solid #ddd;
      border-radius: 8px;
    }
    .button {
      display: inline-block;
      line-height: 36px;
      width: 88px;
      text-align: center;
      font-size: 14px;
      color: #fff;
      background: #f64;
      border-radius: 4px;
    }
    .label {
      display: inline-block;
      line-height: 44px;
      font-size: 14px;
      color: #333;
    }
    .label.counter {
      width: calc(100% - 108px);
      text-align: right;
    }
    .log-box {
      margin: 10px 0;
      min-height: 300px;
      border: 1px solid #ddd;
      border-radius: 8px;
    }
    .log-header {
      padding: 10px;
      line-height: 44px;
      font-size: 16px;
      color: #333;
      background: #eee;
    }
  </style>
</head>
<body>
  <p>
    演示使用 <a href="https://developer.mozilla.org/en-US/docs/Web/API/Background_Tasks_API">
     协作调度幕后任务 </a> 使用 <code>requestIdleCallback()</code>
    方法.
  </p>
  <div class="container">
    <div class="label">解码量子丝极谱发射中...</div>
    <div>
      <progress id="progress" value="0"></progress>
    </div>
    <div class="button" id="startButton">
      开始
    </div>
    <div class="label counter">
      任务 <span id="currentTaskNumber">0</span> / <span id="totalTaskCount">0</span>
    </div>
  </div>
  <div class="log-box">
    <div class="log-header">
      记录
    </div>
    <div id="log">
    </div>
  </div>
</body>
<script type="text/javascript" src="./task.js"></script>
</html>